﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace ImClientApi.Controllers
{
    /// <summary>
    /// 无Auth权限验证的 Base基础操作类
    /// </summary>
    [ApiController]
    [Route("/imapi/[controller]/[action]")]
    public class BaseNoAuthController : ControllerBase
    {
        /// <summary>
        /// 访问来源Ip地址
        /// </summary>
        public string SrcIp => this.Request.Headers["X-Real-IP"].FirstOrDefault() ?? this.Request?.HttpContext?.Connection?.RemoteIpAddress?.ToString() ?? "";
    }
}
